package com.demo.function.spring.httpinterface;

import com.demo.model.entity.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import reactor.core.publisher.Mono;

@HttpExchange(url = "http://localhost:8989")
public interface RestClientMiyaHttpInterfaceClient {

    /**
     * 测试异步返回接口，实际RestClient不支持异步调用
     * @param time 延迟时间，单位秒级
     * @return User对象
     */
    @GetExchange(url = "/processLongTime")
    Mono<User> processLongTime(@RequestParam("timeout") long time);

    @PostExchange(url = "/modifyUser")
    User modifyUser(@RequestBody User user);
}
